<extend name="Public/common" />
<block name="body">
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>订单管理</h3>
      <ul class="tab-base">
        <li><a href="JavaScript:void(0);" class="current"><span>列表</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <form method="get" action="{:U()}" name="form_search">
    <table class="tb-type1 noborder search">
      <tbody>
        <tr>
          <th><label>订单号或收货人电话</label></th>
          <td><input type="text" value="<notempty name="get.keyword">{$get.keyword}</notempty>" name="keyword" id="keyword" class="txt"></td>

          <th><label>会员昵称或OPENID</label></th>
          <td><input type="text" value="<notempty name="get.nickname">{$get.nickname}</notempty>" name="nickname" id="nickname" class="txt"></td>

          <td>
          	<a href="javascript:document.form_search.submit();" class="btn-search " title="查询">&nbsp;</a>
            <notempty name="get">
              <a href="{:U('index')}" class="btns " title="撤销检索"><span>撤销检索</span></a>
            </notempty>
          </td>
        </tr>
        <tr>

          <th><label>下单日期:</label></th>
          <td>
            <input class="txt date" type="text" value="<notempty name="get.start_create_time">{$get['start_create_time']}</notempty>" id="start_create_time" name="start_create_time">
            -
            <input class="txt date" type="text" value="<notempty name="get.end_create_time">{$get['end_create_time']}</notempty>" id="end_create_time" name="end_create_time">
          </td>
          <th><label>支付状态:</label></th>
          <td>
            <select class="querySelect" name="pay_state">
              <option <if condition="(isset($get['pay_state'])) && ($get['pay_state'] === '')">selected='selected'</if> value="">请选择...</option>
              <option <if condition="(isset($get['pay_state'])) && ($get['pay_state'] === 0)">selected='selected'</if> value="0">否</option>
              <option <if condition="(isset($get['pay_state'])) && ($get['pay_state'] == 1)">selected='selected'</if> value="1">是</option>
            </select>
          </td>

          <th><label>楼宇：</label></th>
          <td id="region_id" colspan="8">
            <select class="querySelect" name="region_id">
              <option value="">请选择...</option>
              <notempty name="region">
                <volist name="region" id="vo">
                  <option <notempty name="get.region_id"><eq name="get.region_id" value="$key">selected='selected'</eq></notempty> value="{$key}">{$vo}</option>
                </volist>
              </notempty>
            </select></td>
          <td>


        </tr>
      </tbody>
    </table>
  </form>
<table class="table tb-type2" id="prompt">
	<tbody>
		<tr class="space odd">
			<th colspan="12"><div class="title"><h5>操作提示</h5><span class="arrow"></span></div></th>
		</tr>
		<tr>
			<td><ul>
    <li>点击查看操作将显示订单（包括订单物品）的详细信息</li>
				</ul></td>
		</tr>
	</tbody>
</table>
	<form method="post" id="form1">
    <table class="table tb-type2">
      <thead>
        <tr class="thead">
          <th>订单编号</th>
          <!--<th class="align-center">商户</th>-->
          <!--<th class="align-center">商品</th>-->
          <th class="align-center">昵称</th>
          <th class="align-center">用户ID</th>
          <th class="align-center">渠道</th>
          <th class="align-center">购买次数</th>
          <th class="align-center">买家</th>
          <th class="align-center">电话</th>
          <th class="w108 align-center">楼宇</th>
          <th class="align-center">地址</th>
          <th class="w84 align-center">代金券</th>
          <th class="w108 align-center">订单总额</th>
          <!--<th class="w108 align-center">订单状态</th>-->
          <th class="w84 align-center">支付状态</th>
          <th class="w108 align-center">下单时间</th>
          <th class="w120 align-center">操作</th>
        </tr>
      </thead>
      <tbody>
        <notempty name="list">
        <volist name="list" id="vo">
        <tr class="hover">
          <td>{$vo['order_sn']}</td>
          <!--<td class="align-center">{$store[$vo['store_id']]}</td>-->
          <!--<td class="align-center">{$orderGoods[$vo['order_id']]}</td>-->
          <td class="align-center">{$vo['nickname']}</td>
          <td class="align-center">{$vo['member_id']}</td>
          <php>$vo['channel'] = str_replace('qrscene_', '', $vo['channel']);</php>
          <td class="align-center">{$channel[$vo['channel']]}</td>
          <td class="align-center">{$vo['order_count']}</td>
          <td class="align-center">{$vo['reciver_name']}</td>
          <td class="align-center">{$vo['reciver_phone']}</td>
          <td class="align-center">{$vo['region_name']}</td>
          <td class="align-center">{$vo['address']}</td>
          <td class="align-center">{$coupon[$vo['coupon_id']]['coupon_value']}</td>
          <td class="align-center">{$vo['order_amount']}</td>
          <!--<td class="align-center">{:getOrderState($vo['order_state'])}</td>-->
          <td class="align-center"><eq name="vo.pay_state" value="1">已支付<else />未支付</eq></td>
          <td class="align-center">{$vo['create_time']|time_format}</td>
          <td class="align-center">
          	<a href="{:U('view?id='.$vo['order_id'])}">查看</a>
          	<!--<a href="{:U('edit?id='.$vo['order_id'])}">更改状态</a>-->
          </td>
        </tr>
        </volist>
        <else />
        <tr class="no_data">
          <td colspan="10">没有符合条件的记录</td>
        </tr>
        </notempty>
      </tbody>
      <tfoot>
        <tr class="tfoot">
        <notempty name="page">
          <td colspan="16">
            <a href="{$export_url}" target="_blank" class="btn"><span>导出数据</span></a>
            <div class="pagination"> {$page} </div>
          </td>
         <else />  
          <td colspan="16"></td>
         </notempty>
        </tr>
      </tfoot>
    </table>
  </form>
</div>
  <script type="text/javascript" src="__JS__/jquery-ui/jquery.ui.js"></script>
  <script type="text/javascript" src="__JS__/jquery-ui/i18n/zh-CN.js" charset="utf-8"></script>
  <link rel="stylesheet" type="text/css" href="__JS__/jquery-ui/themes/ui-lightness/jquery.ui.css"  />
<script type="text/javascript">
     function ajax_store_name(){
        $('#store_name_box').show();
        var store_name = $('#store_name').val();
        $.post("{:U('admin/store/ajax')}", { "store_name" : store_name }, function(data) {
            var data = $.parseJSON(data);
            if(data){
                if (data.length > 0)
                {
                    var html = '<ul style="max-height:200px; overflow-y:scroll">';
                    var data = data;
                    for (i = 0; i < data.length; i++)
                    {
                    	html += '<a href="javascript:sel(\'' + data[i].store_id + '\', \'' + data[i].store_name + '\')"><li>' + data[i].store_name + '</li></a>';
                    }
                    html += '</ul>';
                    $('#store_name_box').html(html);
                }
            }
        });
    }
	function sel(store_id, store_name) {
		if (store_id == '0') {
			$('#store_name').val('').focus();
			$('#store_name_box').hide();
		} else {
			$('#store_name').val(store_name);
			$('#store_id').val(store_id);
			$('#store_name_box').hide();
		}
	}
     $(document).ready(function(){
       $('#start_create_time').datepicker({dateFormat: 'yy-mm-dd'});
       $('#end_create_time').datepicker({dateFormat: 'yy-mm-dd'});
     });
</script>
</block>